<%@ page import="java.sql.Statement" import="java.sql.ResultSet" import="java.sql.Connection" %> 
<%@page import="connection.DBConnection"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Supplier Master Report</title>
</head>
<body>
<h2 align="center"> Supplier Master Report </h2>
<form name="fr2" method="post">

  <%
        String exportToExcel = request.getParameter("exportToExcel");
        if (exportToExcel != null && exportToExcel.toString().equalsIgnoreCase("YES")) 
        {
            response.setContentType("application/vnd.ms-excel");
            response.setHeader("Content-Disposition", "inline; filename=" + "SupplierMasterReport.xls");
 
        }
    %>


<table border=1 align="center"> 
<tr>
		<th> Supplier Code </th>
		<th> Supplier Name </th>
		<th> Address </th>
		<th> City </th>
		<th> State </th>
		<th> TIN Number </th>
		<th> PAN Number </th>
		<th> Mobile number </th>
		<th> Email ID</th>
		<th> Contact Person Name</th>
		<th> Opening Balance </th>	 
</tr>


		<%  DBConnection dbc=new DBConnection();
			Connection con=dbc.getNewConnection();
			Statement st = null;
			ResultSet rs = null;
			
			try
			{
			   st=con.createStatement() ;
       		   rs=st.executeQuery("select * from SupplierMaster where status=1"); %>
	        	
       		 <%  while(rs.next()){ %>
<tr>
					<% String code=rs.getString(1);
						String name=rs.getString(2); %>
					
            		<td><%=code %></td>
            		<td><a href="http://localhost:8081/BOA_Web/EditSupplierMaster.jsp?code1=<%=code%>&name1=<%=name%>"> <%=name %></a></td>
            		<td><%= rs.getString(3)%></td>
            		<td><%= rs.getString(4)%></td>
            		<td><%= rs.getString(5)%></td>
            		<td><%= rs.getString(6)%></td>
            		<td><%= rs.getString(7)%></td>
            		<td><%= rs.getString(8)%></td>
            		<td><%= rs.getString(9)%></td>
            		<td><%= rs.getString(10)%></td>
            		<td><%= rs.getDouble(11)%></td>
</tr>
        		<% } %>
  
	 		<% }
			catch(Exception e){} %>


<%--<tr>
		<td> ${CMR.sname} </td> 
		<td> ${CMR.scode} </td>
		<td> ${CMR.saddr} </td>
		<td> ${CMR.scity} </td>
		<td> ${CMR.sstate} </td>
		<td> ${CMR.stin} </td>
		<td> ${CMR.span} </td>
		<td> ${CMR.smob} </td>
		<td> ${CMR.smail} </td>
		<td> ${CMR.sper} </td>
		<td> ${CMR.sopen} </td>
</tr>
--%>

</table><br><br> 
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <%
        if (exportToExcel == null) {
    %>
    <a href="SupplierMasterReport.jsp?exportToExcel=YES">Export to Excel</a>
    <%
        }
    %>
</form>
<br><br>

<form name=deletesupplier action="SupplierMasterDeleteServlet">
<input type="text" name="delete"> 
<input type=submit value="Delete">

<a href="http://localhost:8081/BOA_Web/DeletedSupplierMaster.jsp">Deleted Supplier Masters</a>


<center><input type="button" value="Print this page" onClick="window.print()"></center>

</form>

</body>
</html>